﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Algobox.JuicyLib.MarketData.Structure
{
    public class OHLC
    {
        public OHLC()
        { }

        public OHLC(decimal open, decimal high, decimal low, decimal close, long volume)
        {
            Open = open;
            High = high;
            Low = low;
            Close = close;
            Volume = volume;
        }

        /// <summary>
        /// Parses the input into decimals and long for storage in the OHLC object
        /// </summary>
        /// <param name="open"></param>
        /// <param name="high"></param>
        /// <param name="low"></param>
        /// <param name="close"></param>
        /// <param name="volume"></param>
        /// <exception cref="System.FormatException"/>
        /// <exception cref="System.OverflowException"/>
        public OHLC(string open, string high, string low, string close, string volume)
        {
            Open = Decimal.Parse(open);
            High = Decimal.Parse(high);
            Low = Decimal.Parse(low);
            Close = Decimal.Parse(close);
            Volume = Int64.Parse(volume);
        }

        public decimal Open { get; set; }
        public decimal High { get; set; }
        public decimal Low { get; set; }
        public decimal Close { get; set; }
        public long Volume { get; set; }

        public override string ToString()
        {
            return String.Format("{0}:{1}:{2}:{3}", Open, High, Low, Close);
        }
    }
}
